@isTest

Private class iFulfillTrackTaskHistoryTest{


    static testMethod void test_ifullfill()

    {
        //iFulfillTrackTaskHistory class1 = new iFulfillTrackTaskHistory();
        
        List<Fullfilment_Item__c> FIlist = new List<Fullfilment_Item__c>();
         
         Profile p = [select id from profile where name='System Administrator'];    
       User u = new User(alias = 'ipsys', email='isadmin@accenture.com',emailencodingkey='UTF-8', lastname='TestUser', languagelocalekey='en_US',localesidkey='en_US', profileid = p.Id,timezonesidkey='Asia/Calcutta', username='ifulfilladmin@testorg.com');    
       Insert u;
        
        
          Fullfilment_Item__c FI =  new Fullfilment_Item__c(Main_Listing_Phone_Number__c = '101',Listed_Name__c ='XYZ1',Heading_Name__c ='Heading name1',Item_Id__c = 'Item id' ,Product_Code__c ='p2',UDAC__c ='Udac2',Region__c = 'region2',Transaction_Type__c ='New',ownerid = u.id);        
      
         Fullfilment_Item__c FI2 = new Fullfilment_Item__c(Main_Listing_Phone_Number__c = '100',Listed_Name__c ='XYZ',Heading_Name__c ='Heading name',Item_Id__c = 'Item id' ,Product_Code__c ='p1',UDAC__c ='Udac1',Region__c = 'region1',Transaction_Type__c ='New',ownerid = u.id);       
   
        FIlist.add(FI);
        FIlist.add(FI2);
        insert FI;
        FI.OwnerId =u.Id;
        Update FI;
        list<id> IDlist = new list<id>();
        
        Workflow_definition__c wfd = new Workflow_definition__c();
        wfd.Status__c = 'Active';
           wfd.Workflow_Name__c = 'WF';
           insert wfd;

       Workflow_Stage__c WFS = new Workflow_Stage__c();
            WFS.name = 'Advertiser Approval';
            WFS.Workflow_Code__c = wfd.id;
            insert WFS;
       List<Workflow_Stage__c> Stagelist = new List<Workflow_Stage__c>();
       Stagelist.add(WFS);
       Wokflow_Steps__c wfSteps = new Wokflow_Steps__c();
            wfSteps.name = 'Final Verification';
            wfSteps.Wokflow_Stage_Name__c = WFS.id;
            wfSteps.Target_Days__c = 12;
            insert wfSteps;
            //WS.Wokflow_Stage_Name__c = SD.id;
        List<Wokflow_Steps__c> WST = new List<Wokflow_Steps__c>();
        WST.add(wfSteps);
        Workflow_Activities__c WA = new Workflow_Activities__c();
            WA.name = 'Name';
            WA.Step_Name__c = wfSteps.id;
            WA.Status__c = 'Active';
            WA.Required__c= True;
            insert WA;
        IDlist.add(WA.Step_Name__c);
        Map<id,List<Wokflow_Steps__c>> NewMap= new  Map<id,List<Wokflow_Steps__c>>();
        NewMap.put(WFS.id,WST);   
        set<id> idSet = new set<id>();
        idSet.add(FI.id);  
        /**IDlist.add(FIlist[0].id);
        IDlist.add(FIlist[1].id);**/

        iFulfillTrackTaskHistory.createNewStepHistoryForRemainingCurrentTaskSkip(FI,WFS,WST,FI.ownerId,FI.Owner_Reporting__c);
        iFulfillTrackTaskHistory.createNewStepHistoryForSkip(FI,Stagelist,NewMap,FI.ownerId,FI.Owner_Reporting__c);
        iFulfillTrackTaskHistory.createNoteOnEscalation(FIlist);
       // iFulfillTrackTaskHistory.trackActivityCompletion(IDlist,FIlist);        
    }
}